package edu.wfmanage.models;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import wfmanage.action.newRequest;

import com.util.DB;

public class User {
private String username="";
private  String password="";
private String userid="";
private String emailid="";
private String role="";
private int LTALimit;

public static ArrayList<User> userDetails(String selectionModifier) {
	ArrayList<User> selection = new ArrayList<User>();
	ResultSet resultSet = null;
	String query = "select * from employee " + selectionModifier ;
	Connection connection = DB.getConnection();
	resultSet = DB.readFromDB(query, connection);
	try {
		while (resultSet.next()) {
			User user = new User();
			user.username=resultSet.getString("USER_NAME");
			user.emailid= resultSet.getString("EMAIL_ID");
			user.role= resultSet.getString("EMP_ROLE");
			user.userid= resultSet.getString("user_ID");
			selection.add(user);	
		}
	} catch (SQLException e) {
       System.out.println("Exception while reading from db"+ e);
	}
	DB.close(connection);
	return selection;
}


public int getLTALimit() {
	return LTALimit;
}
public void setLTALimit(int lTALimit) {
	LTALimit = lTALimit;
}
public String getRole() {
	return role;
}
public void setRole(String role) {
	this.role = role;
}
public String getUsername() {
	return username;
}
public void setUsername(String username) {
	this.username = username;
}
public String getPassword() {
	return password;
}
public void setPassword(String password) {
	this.password = password;
}
public String getUserid() {
	return userid;
}
public void setUserid(String userid) {
	this.userid = userid;
}
public String getEmailid() {
	return emailid;
}
public void setEmailid(String emailid) {
	this.emailid = emailid;
}

}
